package com.maiyuren.fishkit.utils

fun ByteArray.toUint32LE(begin:Int = 0): UInt {
    val it = this.asUByteArray()
    var len: UInt = it[0 + begin].toUInt()
    len = len or (it[1 + begin].toUInt() shl 8)
    len = len or (it[2 + begin].toUInt() shl 16)
    len = len or (it[3 + begin].toUInt() shl 24)

    return len
}

fun ByteArray.toInt32LE(begin:Int = 0): Int {
    return this.toUint32LE(begin).toInt()
}